package com.r2coding.auth.service;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.List;

/**
 * @author:98k灬
 * @since:2022/04/09 12:46
 **/
@Data
public class JwtUser implements UserDetails {
    private Integer userId;
    private String username;
    private String avatar;
    private String phone;
    private String email;
    private Integer sex;
    @JSONField(serialize = false) // 忽略转json
    private String password;

    @JSONField(serialize = false)
    private boolean accountNonExpired;

    @JSONField(serialize = false)
    private boolean accountNonLocked;

    @JSONField(serialize = false)
    private boolean credentialsNonExpired;

    @JSONField(serialize = false)
    private boolean isEnabled;

    @JSONField(serialize = false)
    private List<GrantedAuthority> authorities;

    public boolean isAccountNonExpired() {
        return true;
    }

    public boolean isAccountNonLocked() {
        return true;
    }

    public boolean isCredentialsNonExpired() {
        return true;
    }

    public boolean isEnabled() {
        return true;
    }
}
